import { BasicColumn } from '/@/components/Table';
import { FormSchema } from '/@/components/Table';
import { useI18n } from '/@/hooks/web/useI18n';

const { t } = useI18n();

export const columns: BasicColumn[] = [
  {
    title: t('routes.table.roleManagement.roleCode'),
    dataIndex: 'id',
    width: 200,
  },
  {
    title: t('routes.table.roleManagement.roleName'),
    dataIndex: 'name',
    width: 180,
  },
  {
    title: t('routes.table.roleManagement.creator'),
    dataIndex: 'creator',
    width: 180,
  },
  {
    title: t('routes.table.roleManagement.createTime'),
    dataIndex: 'createTime',
    width: 180,
    slots: { customRender: 'createTime' },
  },
  {
    title: t('routes.table.roleManagement.remark'),
    dataIndex: 'remark',
  },
];

export const searchFormSchema: FormSchema[] = [
  {
    field: 'roleName',
    label: t('routes.table.roleManagement.roleName'),
    component: 'Input',
    colProps: { span: 8 },
  },
];

export const formSchema: FormSchema[] = [
  {
    field: 'id',
    label: t('routes.table.roleManagement.roleCode'),
    required: true,
    component: 'Input',
  },
  {
    field: 'name',
    label: t('routes.table.roleManagement.roleName'),
    required: true,
    component: 'Input',
  },
  {
    label: t('routes.table.roleManagement.remark'),
    field: 'remark',
    defaultValue: '',
    component: 'InputTextArea',
  },
  {
    label: ' ',
    field: 'menuList',
    slot: 'menu',
    defaultValue: [],
    component: 'Input',
  },
];
